package Morning;

public class Students implements Comparable<Students> {

    String name;
    int chineseScore;
    int mathsocer;

    public Students() {
    }

    public Students(String name, int chineseScore, int mathsocer) {
        this.name = name;
        this.chineseScore = chineseScore;
        this.mathsocer = mathsocer;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getChineseScore() {
        return chineseScore;
    }

    public void setChineseScore(int chineseScore) {
        this.chineseScore = chineseScore;
    }

    public int getMathsocer() {
        return mathsocer;
    }

    @Override
    public String toString() {
        return "Students{" +
                "name='" + name + '\'' +
                ", chineseScore=" + chineseScore +
                ", mathsocer=" + mathsocer +
                '}'+"总分是: "+(getMathsocer()+getChineseScore());
    }

    public void setMathsocer(int mathsocer) {
        this.mathsocer = mathsocer;
    }


    @Override
    public int compareTo(Students o) {
        int a = (this.getChineseScore()+ this.getMathsocer()-(o.getChineseScore()+o.getMathsocer()));

        if (a == 0)
            a = this.getMathsocer() - o.getMathsocer();

        return a;
    }
}
